package com.itheima.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.itheima.dao.InterventionDao;
import com.itheima.domain.Intervention;
import com.itheima.domain.PageResult;
import com.itheima.service.QueryPageBeanService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author M
 */
@Service
public class QueryPageBeanServiceImpl implements QueryPageBeanService {
    @Autowired
    private InterventionDao interventionDao;
    @Override
    public PageResult pageQuery(Integer currentPage, Integer pageSize, String queryString) {
        PageHelper.startPage(currentPage,pageSize);

        Page<Intervention> page = interventionDao.selectByCondition(queryString);

        return new PageResult(page.getTotal(),page.getResult());
    }
}
